package com.bbcare.followup.plat.controller.fd;


import com.bbcare.comm.ResultModel;
import com.bbcare.followup.plat.dto.request.PatientDumpStatisticsReqDTO;
import com.bbcare.followup.plat.dto.response.PatientDumpLogStatisticsResDTO;
import com.bbcare.followup.plat.dto.response.PatientDumpTimesStatisticsResDTO;
import com.bbcare.followup.plat.dto.response.PatientDumpUseDrugStatisticsResDTO;
import com.bbcare.followup.plat.service.IDumpChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 泵乳图表统计和导出
 * @author： liqianlong
 */
@RestController
@RequestMapping("/service/dumpChart")
public class DumpChartController {


    @Autowired
    private IDumpChartService dumpChartService;

    /**
     * 泵乳日志统计
     * @param reqDTO 请求模型
     * @return
     */
    @PostMapping("patient/log/statistics")
    public ResultModel<List<PatientDumpLogStatisticsResDTO>> patientLogStatistics(@RequestBody PatientDumpStatisticsReqDTO reqDTO) {
        List<PatientDumpLogStatisticsResDTO> resDTOS =  dumpChartService.patientLogStatistics(reqDTO);
        return new ResultModel(resDTOS);
    }


    /**
     * 泵乳次数统计
     * @param reqDTO 请求模型
     * @return
     */
    @PostMapping("/patient/times/statistics")
    public ResultModel<List<PatientDumpTimesStatisticsResDTO>> patientTimesStatistics(@RequestBody PatientDumpStatisticsReqDTO reqDTO) {
        List<PatientDumpTimesStatisticsResDTO> resDTOS =  dumpChartService.patientTimesStatistics(reqDTO);
        return new ResultModel(resDTOS);
    }

    /**
     * 用药情况统计
     * @param reqDTO 请求模型
     * @return
     */
    @PostMapping("/patient/useDrug/statistics")
    public ResultModel<List<PatientDumpUseDrugStatisticsResDTO>> patientUseDrugStatistics(@RequestBody PatientDumpStatisticsReqDTO reqDTO) {
        List<PatientDumpUseDrugStatisticsResDTO> resDTOS =  dumpChartService.patientUseDrugStatistics(reqDTO);
        return new ResultModel(resDTOS);
    }
}
